foo22 = "fasfdas"; 
function test(foo, bar){
          foobar = (typeof foo22 == "undefined") ? bar : foo;
}